package de.openkanban.shared.dto;

import java.util.HashMap;
import java.util.Map;

import de.openkanban.client.ui.presenter.RequestParameterMap;
import de.openkanban.client.util.JsonConverter;

/**
 * Data Transfer Object used for transferring Activity information
 */
public class ActivityDto extends StatusDto implements RequestParameterMap {

	private Long activityId;

	private String activityName;
	private int wipLimit;

	public ActivityDto() {
	}

	public ActivityDto(String json) {
		activityId = JsonConverter.getLongValueOrNull(json, "activityId");
		activityName = JsonConverter.getStringValueOrNull(json, "activityName");
		wipLimit = JsonConverter.getIntegerValueOrNull(json, "wipLimit");
	}

	public Long getActivityId() {
		return activityId;
	}

	public void setActivityId(Long activityId) {
		this.activityId = activityId;
	}

	public String getActivityName() {
		return activityName;
	}

	public void setActivityName(String activityName) {
		this.activityName = activityName;
	}

	public int getWipLimit() {
		return wipLimit;
	}

	public void setWipLimit(int wipLimit) {
		this.wipLimit = wipLimit;
	}

	@Override
	public Map<String, String> valuesToMap() {
		Map<String, String> activityMap = new HashMap<String, String>();
		if (activityId != null) {
			activityMap.put("activityId", Long.toString(activityId));
		}
		activityMap.put("activityName", activityName);
		activityMap.put("wipLimit", Integer.toString(wipLimit));
		return activityMap;
	}

	@Override
	public String toString() {
		return "ActivityDto [activityId=" + activityId + ", activityName=" + activityName + ", wipLimit=" + wipLimit + "]";
	}

}
